package org.sirmupadbapi.persistencia;

import org.sirmupadbapi.beans.Vehicles;
import java.sql.Date; 
import org.sirmupadbapi.beans.*;
import org.sirmupadbapi.controller.*;
import java.io.Serializable;
import java.util.List;
import java.util.ArrayList;
import java.util.*;
import java.sql.Connection;
import java.sql.Statement;
import java.sql.ResultSet;
import java.sql.PreparedStatement;
import java.util.Map;
import java.util.Iterator;
import java.util.HashMap;
import java.util.Map;
 import javax.sql.DataSource;
import org.sirmupadbapi.generales.Mensajeria;
import org.sirmupadbapi.generales.DataGManager;


/**
*
* @author
*/

public class VehiclesPersistencia implements Serializable {
private static final long serialVersionUID = 1L;
public static Exception excepcion;
public static boolean esMensaje = false;
public static Connection con = null;
public static java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("org/sirmupadbapi/properties/mensajes");
static DataGManager dataGManager;
static List<Vehicles> list;

public VehiclesPersistencia(){
         esMensaje =false;
}


/**
*
* insert()
*/

public static boolean insert (Vehicles vehicles ) {
  excepcion = null;
  try {
      esMensaje =false;
   
   
   

  con= dataGManager.getCon();
  if (con == null) {
      excepcion=new Exception(bundle.getString("msg.noconecction"));
      return false;
  }
      PreparedStatement pinsert = null;
      String sql = "insert into vehicles(IDVEHICULO,PLACA,MARCA,MODELO,ANIO,CHASIS,CAPACIDAD,VALOR,MOTOR,COLOR,DESCRIPCION,TIPO,COMBUSTIBLE,USO,ID,TIPOID,HIPOTECADO,SECUESTRADO,TRASPASO,ACTIVO,IDMUNICIPIO,PAGOINSCRIPCION,FECHAINSCRIPCION,FECHA,USERNAME,LIQUIDACION,FECHALIQUIDACION,MESPAGO,FIDEICOMISO)  values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
      pinsert = con.prepareStatement(sql);
              pinsert.setLong(1,vehicles.getIDVEHICULO());
        pinsert.setString(2,vehicles.getPLACA());
        pinsert.setString(3,vehicles.getMARCA());
        pinsert.setString(4,vehicles.getMODELO());
        pinsert.setInt(5,vehicles.getANIO());
        pinsert.setString(6,vehicles.getCHASIS());
        pinsert.setString(7,vehicles.getCAPACIDAD());
        pinsert.setDouble(8,vehicles.getVALOR());
        pinsert.setString(9,vehicles.getMOTOR());
        pinsert.setString(10,vehicles.getCOLOR());
        pinsert.setString(11,vehicles.getDESCRIPCION());
        pinsert.setString(12,vehicles.getTIPO());
        pinsert.setString(13,vehicles.getCOMBUSTIBLE());
        pinsert.setString(14,vehicles.getUSO());
        pinsert.setString(15,vehicles.getID());
        pinsert.setString(16,vehicles.getTIPOID());
        pinsert.setString(17,vehicles.getHIPOTECADO());
        pinsert.setString(18,vehicles.getSECUESTRADO());
        pinsert.setString(19,vehicles.getTRASPASO());
        pinsert.setString(20,vehicles.getACTIVO());
        pinsert.setString(21,vehicles.getIDMUNICIPIO());
        pinsert.setString(22,vehicles.getPAGOINSCRIPCION());
        pinsert.setDate(23,vehicles.getFECHAINSCRIPCION());
        pinsert.setDate(24,vehicles.getFECHA());
        pinsert.setString(25,vehicles.getUSERNAME());
        pinsert.setString(26,vehicles.getLIQUIDACION());
        pinsert.setDate(27,vehicles.getFECHALIQUIDACION());
        pinsert.setString(28,vehicles.getMESPAGO());
        pinsert.setString(29,vehicles.getFIDEICOMISO());
      int filas= pinsert.executeUpdate();
      pinsert.close();
      return true;
   } catch (Exception e) {
      excepcion = e;
   } finally {
  }
  return false;
 }


/**
*
* update()
*/

public static boolean update(Vehicles vehicles ) {
  excepcion = null;
  try {
      esMensaje =false;

  con= dataGManager.getCon();
  if (con == null) {
      excepcion=new Exception(bundle.getString("msg.noconecction"));
      return false;
  }
      PreparedStatement pupdate = null;
      String sql = "update vehicles set  IDVEHICULO=?, PLACA=?, MARCA=?, MODELO=?, ANIO=?, CHASIS=?, CAPACIDAD=?, VALOR=?, MOTOR=?, COLOR=?, DESCRIPCION=?, TIPO=?, COMBUSTIBLE=?, USO=?, ID=?, TIPOID=?, HIPOTECADO=?, SECUESTRADO=?, TRASPASO=?, ACTIVO=?, IDMUNICIPIO=?, PAGOINSCRIPCION=?, FECHAINSCRIPCION=?, FECHA=?, USERNAME=?, LIQUIDACION=?, FECHALIQUIDACION=?, MESPAGO=?, FIDEICOMISO=?  where  IDVEHICULO ='"+vehicles.getIDVEHICULO()+"' and  IDMUNICIPIO ='"+vehicles.getIDMUNICIPIO()+"'  ";
      pupdate= con.prepareStatement(sql);
      pupdate.setLong(1,vehicles.getIDVEHICULO());
pupdate.setString(2,vehicles.getPLACA());
pupdate.setString(3,vehicles.getMARCA());
pupdate.setString(4,vehicles.getMODELO());
pupdate.setInt(5,vehicles.getANIO());
pupdate.setString(6,vehicles.getCHASIS());
pupdate.setString(7,vehicles.getCAPACIDAD());
pupdate.setDouble(8,vehicles.getVALOR());
pupdate.setString(9,vehicles.getMOTOR());
pupdate.setString(10,vehicles.getCOLOR());
pupdate.setString(11,vehicles.getDESCRIPCION());
pupdate.setString(12,vehicles.getTIPO());
pupdate.setString(13,vehicles.getCOMBUSTIBLE());
pupdate.setString(14,vehicles.getUSO());
pupdate.setString(15,vehicles.getID());
pupdate.setString(16,vehicles.getTIPOID());
pupdate.setString(17,vehicles.getHIPOTECADO());
pupdate.setString(18,vehicles.getSECUESTRADO());
pupdate.setString(19,vehicles.getTRASPASO());
pupdate.setString(20,vehicles.getACTIVO());
pupdate.setString(21,vehicles.getIDMUNICIPIO());
pupdate.setString(22,vehicles.getPAGOINSCRIPCION());
pupdate.setDate(23,vehicles.getFECHAINSCRIPCION());
pupdate.setDate(24,vehicles.getFECHA());
pupdate.setString(25,vehicles.getUSERNAME());
pupdate.setString(26,vehicles.getLIQUIDACION());
pupdate.setDate(27,vehicles.getFECHALIQUIDACION());
pupdate.setString(28,vehicles.getMESPAGO());
pupdate.setString(29,vehicles.getFIDEICOMISO());
      int filas= pupdate.executeUpdate();
      pupdate.close();
      if (filas <= 0){
          excepcion=new Exception(bundle.getString("msg.noupdate"));
          esMensaje =true;
          return false;
      }
      return true;
   } catch (Exception e) {
      excepcion = e;
   } finally {
  }
  return false;
}


/**
*
* update()
*/

public static boolean update(String sqlupdate ) {
  excepcion = null;
  try {
      esMensaje =false;

  con= dataGManager.getCon();
  if (con == null) {
      excepcion=new Exception(bundle.getString("msg.noconecction"));
      return false;
  }
      PreparedStatement pupdate = null;
      String sql = "update  vehicles set " + sqlupdate +"";
      pupdate= con.prepareStatement(sql);
      int filas= pupdate.executeUpdate();
      pupdate.close();
      if (filas <= 0){
          excepcion=new Exception(bundle.getString("msg.noupdate"));
          esMensaje =true;
          return false;
      }
      return true;
   } catch (Exception e) {
      excepcion = e;
   } finally {
  }
  return false;
}


/**
*
* updatePrimaryKey()
*/

public static boolean updatePrimaryKey(Vehicles vehicles_old , Vehicles vehicles) {
  excepcion = null;
  try {
      esMensaje =false;

  con= dataGManager.getCon();
  if (con == null) {
      excepcion=new Exception(bundle.getString("msg.noconecction"));
      return false;
  }
      PreparedStatement pupdate = null;
      String sql = "update vehicles set  IDVEHICULO=? ,  IDMUNICIPIO=?  where  IDVEHICULO ='"+vehicles_old.getIDVEHICULO()+"' and  IDMUNICIPIO ='"+vehicles_old.getIDMUNICIPIO()+"'  ";
      pupdate= con.prepareStatement(sql);
      pupdate.setLong(1,vehicles.getIDVEHICULO());pupdate.setString(21,vehicles.getIDMUNICIPIO());
      int filas= pupdate.executeUpdate();
      pupdate.close();
      if (filas <= 0){
          excepcion=new Exception(bundle.getString("msg.noupdate"));
          esMensaje =true;
          return false;
      }
      return true;
   } catch (Exception e) {
      excepcion = e;
   } finally {
  }
  return false;
}


/**
*
* delete()
*/

public static boolean delete(Vehicles vehicles ) {
  excepcion = null;
  try {
      esMensaje =false;

  con= dataGManager.getCon();
  if (con == null) {
      excepcion=new Exception(bundle.getString("msg.noconecction"));
      return false;
  }
      PreparedStatement pdelete = null;
      String sql = "delete from vehicles  where  IDVEHICULO = ? and  IDMUNICIPIO = ?  ";
      pdelete= con.prepareStatement(sql);
      pdelete.setLong(1,vehicles.getIDVEHICULO());
pdelete.setString(21,vehicles.getIDMUNICIPIO());
      int filas= pdelete.executeUpdate();
      pdelete.close();
      if (filas <= 0){
          excepcion=new Exception(bundle.getString("msg.nodelete"));
          esMensaje =true;
          return false;
      }
      return true;
   } catch (Exception e) {
      excepcion = e;
   } finally {
  }
  return false;
}


/**
*
* delete()
*/

public static boolean delete(String sqldelete ) {
  excepcion = null;
  try {
      esMensaje =false;

  con= dataGManager.getCon();
  if (con == null) {
      excepcion=new Exception(bundle.getString("msg.noconecction"));
      return false;
  }
      PreparedStatement pdelete = null;
      String sql = "delete from vehicles where " + sqldelete +"";
      pdelete= con.prepareStatement(sql);
      int filas= pdelete.executeUpdate();
      pdelete.close();
      if (filas <= 0){
          excepcion=new Exception(bundle.getString("msg.nodelete"));
          esMensaje =true;
          return false;
      }
      return true;
   } catch (Exception e) {
      excepcion = e;
   } finally {
  }
  return false;
}


/**
*
* deleteAll()
*/

public static boolean deleteAll() {
  excepcion = null;
  try {
      esMensaje =false;

  con= dataGManager.getCon();
  if (con == null) {
      excepcion=new Exception(bundle.getString("msg.noconecction"));
      return false;
  }
      PreparedStatement pdelete = null;
      String sql = "delete from vehicles  ";
      pdelete= con.prepareStatement(sql);
      int filas= pdelete.executeUpdate();
      pdelete.close();
      if (filas <= 0){
          excepcion=new Exception(bundle.getString("msg.nodeleteall"));
          esMensaje =true;
          return false;
      }
      return true;
   } catch (Exception e) {
      excepcion = e;
   } finally {
  }
  return false;
}


/**
*
* exists()
*/



public static boolean exists(Vehicles vehicles) {
  excepcion = null;
  try {
      esMensaje =false;

  con= dataGManager.getCon();
  if (con == null) {
      excepcion=new Exception(bundle.getString("msg.noconecction"));
      return false;
  }
      String sql = "select * from vehicles where IDVEHICULO='"+vehicles.getIDVEHICULO()+"' and IDMUNICIPIO='"+vehicles.getIDMUNICIPIO()+"'";
  PreparedStatement psquery = con.prepareStatement(sql,ResultSet.TYPE_SCROLL_INSENSITIVE,
                                      ResultSet.CONCUR_UPDATABLE);
   ResultSet rs = psquery.executeQuery();
   rs.next();
   int x = rs.getRow();
   if (x == 0) {
          excepcion=new Exception(bundle.getString("msg.nofoundrecords") + "vehicles" +" " + bundle.getString("msg.withcode"));
          esMensaje =true;
      rs.close();
      psquery.close();
      return false;
   }
    rs.close();
    psquery.close();
 return true;
} catch (Exception ex) {
      excepcion = ex;
}
  return false;
}


/**
*
* findByPrimaryKey()
*/



public static Vehicles findByPrimaryKey(Vehicles vehicles) {
  excepcion = null;
  try {
      esMensaje =false;

  con= dataGManager.getCon();
  if (con == null) {
      excepcion=new Exception(bundle.getString("msg.noconecction"));
      return null;
  }
      String sql = "select * from vehicles where IDVEHICULO='"+vehicles.getIDVEHICULO()+"' and IDMUNICIPIO='"+vehicles.getIDMUNICIPIO()+"'";
  PreparedStatement psquery = con.prepareStatement(sql,ResultSet.TYPE_SCROLL_INSENSITIVE,
                                      ResultSet.CONCUR_UPDATABLE);
   ResultSet rs = psquery.executeQuery();
   rs.next();
   int x = rs.getRow();
   if (x == 0) {
          excepcion=new Exception(bundle.getString("msg.nofoundrecords") + "vehicles" +"  "+ bundle.getString("msg.withcode"));
          esMensaje =true;
      rs.close();
      psquery.close();
      return null;
   }
   rs.beforeFirst();
   while (rs.next()) {
   
            
            
            vehicles.setIDVEHICULO(rs.getLong("IDVEHICULO"));
vehicles.setPLACA(rs.getString("PLACA"));
vehicles.setMARCA(rs.getString("MARCA"));
vehicles.setMODELO(rs.getString("MODELO"));
vehicles.setANIO(rs.getInt("ANIO"));
vehicles.setCHASIS(rs.getString("CHASIS"));
vehicles.setCAPACIDAD(rs.getString("CAPACIDAD"));
vehicles.setVALOR(rs.getDouble("VALOR"));
vehicles.setMOTOR(rs.getString("MOTOR"));
vehicles.setCOLOR(rs.getString("COLOR"));
vehicles.setDESCRIPCION(rs.getString("DESCRIPCION"));
vehicles.setTIPO(rs.getString("TIPO"));
vehicles.setCOMBUSTIBLE(rs.getString("COMBUSTIBLE"));
vehicles.setUSO(rs.getString("USO"));
vehicles.setID(rs.getString("ID"));
vehicles.setTIPOID(rs.getString("TIPOID"));
vehicles.setHIPOTECADO(rs.getString("HIPOTECADO"));
vehicles.setSECUESTRADO(rs.getString("SECUESTRADO"));
vehicles.setTRASPASO(rs.getString("TRASPASO"));
vehicles.setACTIVO(rs.getString("ACTIVO"));
vehicles.setIDMUNICIPIO(rs.getString("IDMUNICIPIO"));
vehicles.setPAGOINSCRIPCION(rs.getString("PAGOINSCRIPCION"));
vehicles.setFECHAINSCRIPCION(rs.getDate("FECHAINSCRIPCION"));
vehicles.setFECHA(rs.getDate("FECHA"));
vehicles.setUSERNAME(rs.getString("USERNAME"));
vehicles.setLIQUIDACION(rs.getString("LIQUIDACION"));
vehicles.setFECHALIQUIDACION(rs.getDate("FECHALIQUIDACION"));
vehicles.setMESPAGO(rs.getString("MESPAGO"));
vehicles.setFIDEICOMISO(rs.getString("FIDEICOMISO"));
    }
    rs.close();
    psquery.close();
 return vehicles;
} catch (Exception ex) {
      excepcion = ex;
}
  return null;
}


/**
*
* findByIDVEHICULO()
*/

public static List<Vehicles> findByIDVEHICULO(Vehicles vehicles,boolean withRelation) {
  excepcion = null;
  try {
      esMensaje =false;

  con= dataGManager.getCon();
  if (con == null) {
      excepcion=new Exception(bundle.getString("msg.noconecction"));
      return null;
  }
       list = new ArrayList<Vehicles>();
      String sql = "select * from vehicles where IDVEHICULO='"+vehicles.getIDVEHICULO()+"'";
  PreparedStatement psquery = con.prepareStatement(sql,ResultSet.TYPE_SCROLL_INSENSITIVE,
                                      ResultSet.CONCUR_UPDATABLE);
   ResultSet rs = psquery.executeQuery();
   rs.next();
   int x = rs.getRow();
   if (x == 0) {
          excepcion=new Exception(bundle.getString("msg.nofoundrecords") + "vehicles" +"  "+ bundle.getString("msg.withcode"));
          esMensaje =true;
      rs.close();
      psquery.close();
      return null;
   }
   rs.beforeFirst();
   while (rs.next()) {
   
        Vehicles vehicles2 = new Vehicles(
         rs.getLong("IDVEHICULO"),rs.getString("PLACA"),rs.getString("MARCA"),rs.getString("MODELO"),rs.getInt("ANIO"),rs.getString("CHASIS"),rs.getString("CAPACIDAD"),rs.getDouble("VALOR"),rs.getString("MOTOR"),rs.getString("COLOR"),rs.getString("DESCRIPCION"),rs.getString("TIPO"),rs.getString("COMBUSTIBLE"),rs.getString("USO"),rs.getString("ID"),rs.getString("TIPOID"),rs.getString("HIPOTECADO"),rs.getString("SECUESTRADO"),rs.getString("TRASPASO"),rs.getString("ACTIVO"),rs.getString("IDMUNICIPIO"),rs.getString("PAGOINSCRIPCION"),rs.getDate("FECHAINSCRIPCION"),rs.getDate("FECHA"),rs.getString("USERNAME"),rs.getString("LIQUIDACION"),rs.getDate("FECHALIQUIDACION"),rs.getString("MESPAGO"),rs.getString("FIDEICOMISO"));
            
            
       list.add(vehicles2);
    }
    rs.close();
    psquery.close();
    return list;
} catch (Exception ex) {
      excepcion = ex;
}
  return null;
}


/**
*
* findByPLACA()
*/

public static List<Vehicles> findByPLACA(Vehicles vehicles,boolean withRelation) {
  excepcion = null;
  try {
      esMensaje =false;

  con= dataGManager.getCon();
  if (con == null) {
      excepcion=new Exception(bundle.getString("msg.noconecction"));
      return null;
  }
       list = new ArrayList<Vehicles>();
      String sql = "select * from vehicles where PLACA='"+vehicles.getPLACA()+"'";
  PreparedStatement psquery = con.prepareStatement(sql,ResultSet.TYPE_SCROLL_INSENSITIVE,
                                      ResultSet.CONCUR_UPDATABLE);
   ResultSet rs = psquery.executeQuery();
   rs.next();
   int x = rs.getRow();
   if (x == 0) {
          excepcion=new Exception(bundle.getString("msg.nofoundrecords") + "vehicles" +"  "+ bundle.getString("msg.withcode"));
          esMensaje =true;
      rs.close();
      psquery.close();
      return null;
   }
   rs.beforeFirst();
   while (rs.next()) {
   
        Vehicles vehicles2 = new Vehicles(
         rs.getLong("IDVEHICULO"),rs.getString("PLACA"),rs.getString("MARCA"),rs.getString("MODELO"),rs.getInt("ANIO"),rs.getString("CHASIS"),rs.getString("CAPACIDAD"),rs.getDouble("VALOR"),rs.getString("MOTOR"),rs.getString("COLOR"),rs.getString("DESCRIPCION"),rs.getString("TIPO"),rs.getString("COMBUSTIBLE"),rs.getString("USO"),rs.getString("ID"),rs.getString("TIPOID"),rs.getString("HIPOTECADO"),rs.getString("SECUESTRADO"),rs.getString("TRASPASO"),rs.getString("ACTIVO"),rs.getString("IDMUNICIPIO"),rs.getString("PAGOINSCRIPCION"),rs.getDate("FECHAINSCRIPCION"),rs.getDate("FECHA"),rs.getString("USERNAME"),rs.getString("LIQUIDACION"),rs.getDate("FECHALIQUIDACION"),rs.getString("MESPAGO"),rs.getString("FIDEICOMISO"));
            
            
       list.add(vehicles2);
    }
    rs.close();
    psquery.close();
    return list;
} catch (Exception ex) {
      excepcion = ex;
}
  return null;
}


/**
*
* findByMARCA()
*/

public static List<Vehicles> findByMARCA(Vehicles vehicles,boolean withRelation) {
  excepcion = null;
  try {
      esMensaje =false;

  con= dataGManager.getCon();
  if (con == null) {
      excepcion=new Exception(bundle.getString("msg.noconecction"));
      return null;
  }
       list = new ArrayList<Vehicles>();
      String sql = "select * from vehicles where MARCA='"+vehicles.getMARCA()+"'";
  PreparedStatement psquery = con.prepareStatement(sql,ResultSet.TYPE_SCROLL_INSENSITIVE,
                                      ResultSet.CONCUR_UPDATABLE);
   ResultSet rs = psquery.executeQuery();
   rs.next();
   int x = rs.getRow();
   if (x == 0) {
          excepcion=new Exception(bundle.getString("msg.nofoundrecords") + "vehicles" +"  "+ bundle.getString("msg.withcode"));
          esMensaje =true;
      rs.close();
      psquery.close();
      return null;
   }
   rs.beforeFirst();
   while (rs.next()) {
   
        Vehicles vehicles2 = new Vehicles(
         rs.getLong("IDVEHICULO"),rs.getString("PLACA"),rs.getString("MARCA"),rs.getString("MODELO"),rs.getInt("ANIO"),rs.getString("CHASIS"),rs.getString("CAPACIDAD"),rs.getDouble("VALOR"),rs.getString("MOTOR"),rs.getString("COLOR"),rs.getString("DESCRIPCION"),rs.getString("TIPO"),rs.getString("COMBUSTIBLE"),rs.getString("USO"),rs.getString("ID"),rs.getString("TIPOID"),rs.getString("HIPOTECADO"),rs.getString("SECUESTRADO"),rs.getString("TRASPASO"),rs.getString("ACTIVO"),rs.getString("IDMUNICIPIO"),rs.getString("PAGOINSCRIPCION"),rs.getDate("FECHAINSCRIPCION"),rs.getDate("FECHA"),rs.getString("USERNAME"),rs.getString("LIQUIDACION"),rs.getDate("FECHALIQUIDACION"),rs.getString("MESPAGO"),rs.getString("FIDEICOMISO"));
            
            
       list.add(vehicles2);
    }
    rs.close();
    psquery.close();
    return list;
} catch (Exception ex) {
      excepcion = ex;
}
  return null;
}


/**
*
* findByMODELO()
*/

public static List<Vehicles> findByMODELO(Vehicles vehicles,boolean withRelation) {
  excepcion = null;
  try {
      esMensaje =false;

  con= dataGManager.getCon();
  if (con == null) {
      excepcion=new Exception(bundle.getString("msg.noconecction"));
      return null;
  }
       list = new ArrayList<Vehicles>();
      String sql = "select * from vehicles where MODELO='"+vehicles.getMODELO()+"'";
  PreparedStatement psquery = con.prepareStatement(sql,ResultSet.TYPE_SCROLL_INSENSITIVE,
                                      ResultSet.CONCUR_UPDATABLE);
   ResultSet rs = psquery.executeQuery();
   rs.next();
   int x = rs.getRow();
   if (x == 0) {
          excepcion=new Exception(bundle.getString("msg.nofoundrecords") + "vehicles" +"  "+ bundle.getString("msg.withcode"));
          esMensaje =true;
      rs.close();
      psquery.close();
      return null;
   }
   rs.beforeFirst();
   while (rs.next()) {
   
        Vehicles vehicles2 = new Vehicles(
         rs.getLong("IDVEHICULO"),rs.getString("PLACA"),rs.getString("MARCA"),rs.getString("MODELO"),rs.getInt("ANIO"),rs.getString("CHASIS"),rs.getString("CAPACIDAD"),rs.getDouble("VALOR"),rs.getString("MOTOR"),rs.getString("COLOR"),rs.getString("DESCRIPCION"),rs.getString("TIPO"),rs.getString("COMBUSTIBLE"),rs.getString("USO"),rs.getString("ID"),rs.getString("TIPOID"),rs.getString("HIPOTECADO"),rs.getString("SECUESTRADO"),rs.getString("TRASPASO"),rs.getString("ACTIVO"),rs.getString("IDMUNICIPIO"),rs.getString("PAGOINSCRIPCION"),rs.getDate("FECHAINSCRIPCION"),rs.getDate("FECHA"),rs.getString("USERNAME"),rs.getString("LIQUIDACION"),rs.getDate("FECHALIQUIDACION"),rs.getString("MESPAGO"),rs.getString("FIDEICOMISO"));
            
            
       list.add(vehicles2);
    }
    rs.close();
    psquery.close();
    return list;
} catch (Exception ex) {
      excepcion = ex;
}
  return null;
}


/**
*
* findByANIO()
*/

public static List<Vehicles> findByANIO(Vehicles vehicles,boolean withRelation) {
  excepcion = null;
  try {
      esMensaje =false;

  con= dataGManager.getCon();
  if (con == null) {
      excepcion=new Exception(bundle.getString("msg.noconecction"));
      return null;
  }
       list = new ArrayList<Vehicles>();
      String sql = "select * from vehicles where ANIO='"+vehicles.getANIO()+"'";
  PreparedStatement psquery = con.prepareStatement(sql,ResultSet.TYPE_SCROLL_INSENSITIVE,
                                      ResultSet.CONCUR_UPDATABLE);
   ResultSet rs = psquery.executeQuery();
   rs.next();
   int x = rs.getRow();
   if (x == 0) {
          excepcion=new Exception(bundle.getString("msg.nofoundrecords") + "vehicles" +"  "+ bundle.getString("msg.withcode"));
          esMensaje =true;
      rs.close();
      psquery.close();
      return null;
   }
   rs.beforeFirst();
   while (rs.next()) {
   
        Vehicles vehicles2 = new Vehicles(
         rs.getLong("IDVEHICULO"),rs.getString("PLACA"),rs.getString("MARCA"),rs.getString("MODELO"),rs.getInt("ANIO"),rs.getString("CHASIS"),rs.getString("CAPACIDAD"),rs.getDouble("VALOR"),rs.getString("MOTOR"),rs.getString("COLOR"),rs.getString("DESCRIPCION"),rs.getString("TIPO"),rs.getString("COMBUSTIBLE"),rs.getString("USO"),rs.getString("ID"),rs.getString("TIPOID"),rs.getString("HIPOTECADO"),rs.getString("SECUESTRADO"),rs.getString("TRASPASO"),rs.getString("ACTIVO"),rs.getString("IDMUNICIPIO"),rs.getString("PAGOINSCRIPCION"),rs.getDate("FECHAINSCRIPCION"),rs.getDate("FECHA"),rs.getString("USERNAME"),rs.getString("LIQUIDACION"),rs.getDate("FECHALIQUIDACION"),rs.getString("MESPAGO"),rs.getString("FIDEICOMISO"));
            
            
       list.add(vehicles2);
    }
    rs.close();
    psquery.close();
    return list;
} catch (Exception ex) {
      excepcion = ex;
}
  return null;
}


/**
*
* findByCHASIS()
*/

public static List<Vehicles> findByCHASIS(Vehicles vehicles,boolean withRelation) {
  excepcion = null;
  try {
      esMensaje =false;

  con= dataGManager.getCon();
  if (con == null) {
      excepcion=new Exception(bundle.getString("msg.noconecction"));
      return null;
  }
       list = new ArrayList<Vehicles>();
      String sql = "select * from vehicles where CHASIS='"+vehicles.getCHASIS()+"'";
  PreparedStatement psquery = con.prepareStatement(sql,ResultSet.TYPE_SCROLL_INSENSITIVE,
                                      ResultSet.CONCUR_UPDATABLE);
   ResultSet rs = psquery.executeQuery();
   rs.next();
   int x = rs.getRow();
   if (x == 0) {
          excepcion=new Exception(bundle.getString("msg.nofoundrecords") + "vehicles" +"  "+ bundle.getString("msg.withcode"));
          esMensaje =true;
      rs.close();
      psquery.close();
      return null;
   }
   rs.beforeFirst();
   while (rs.next()) {
   
        Vehicles vehicles2 = new Vehicles(
         rs.getLong("IDVEHICULO"),rs.getString("PLACA"),rs.getString("MARCA"),rs.getString("MODELO"),rs.getInt("ANIO"),rs.getString("CHASIS"),rs.getString("CAPACIDAD"),rs.getDouble("VALOR"),rs.getString("MOTOR"),rs.getString("COLOR"),rs.getString("DESCRIPCION"),rs.getString("TIPO"),rs.getString("COMBUSTIBLE"),rs.getString("USO"),rs.getString("ID"),rs.getString("TIPOID"),rs.getString("HIPOTECADO"),rs.getString("SECUESTRADO"),rs.getString("TRASPASO"),rs.getString("ACTIVO"),rs.getString("IDMUNICIPIO"),rs.getString("PAGOINSCRIPCION"),rs.getDate("FECHAINSCRIPCION"),rs.getDate("FECHA"),rs.getString("USERNAME"),rs.getString("LIQUIDACION"),rs.getDate("FECHALIQUIDACION"),rs.getString("MESPAGO"),rs.getString("FIDEICOMISO"));
            
            
       list.add(vehicles2);
    }
    rs.close();
    psquery.close();
    return list;
} catch (Exception ex) {
      excepcion = ex;
}
  return null;
}


/**
*
* findByCAPACIDAD()
*/

public static List<Vehicles> findByCAPACIDAD(Vehicles vehicles,boolean withRelation) {
  excepcion = null;
  try {
      esMensaje =false;

  con= dataGManager.getCon();
  if (con == null) {
      excepcion=new Exception(bundle.getString("msg.noconecction"));
      return null;
  }
       list = new ArrayList<Vehicles>();
      String sql = "select * from vehicles where CAPACIDAD='"+vehicles.getCAPACIDAD()+"'";
  PreparedStatement psquery = con.prepareStatement(sql,ResultSet.TYPE_SCROLL_INSENSITIVE,
                                      ResultSet.CONCUR_UPDATABLE);
   ResultSet rs = psquery.executeQuery();
   rs.next();
   int x = rs.getRow();
   if (x == 0) {
          excepcion=new Exception(bundle.getString("msg.nofoundrecords") + "vehicles" +"  "+ bundle.getString("msg.withcode"));
          esMensaje =true;
      rs.close();
      psquery.close();
      return null;
   }
   rs.beforeFirst();
   while (rs.next()) {
   
        Vehicles vehicles2 = new Vehicles(
         rs.getLong("IDVEHICULO"),rs.getString("PLACA"),rs.getString("MARCA"),rs.getString("MODELO"),rs.getInt("ANIO"),rs.getString("CHASIS"),rs.getString("CAPACIDAD"),rs.getDouble("VALOR"),rs.getString("MOTOR"),rs.getString("COLOR"),rs.getString("DESCRIPCION"),rs.getString("TIPO"),rs.getString("COMBUSTIBLE"),rs.getString("USO"),rs.getString("ID"),rs.getString("TIPOID"),rs.getString("HIPOTECADO"),rs.getString("SECUESTRADO"),rs.getString("TRASPASO"),rs.getString("ACTIVO"),rs.getString("IDMUNICIPIO"),rs.getString("PAGOINSCRIPCION"),rs.getDate("FECHAINSCRIPCION"),rs.getDate("FECHA"),rs.getString("USERNAME"),rs.getString("LIQUIDACION"),rs.getDate("FECHALIQUIDACION"),rs.getString("MESPAGO"),rs.getString("FIDEICOMISO"));
            
            
       list.add(vehicles2);
    }
    rs.close();
    psquery.close();
    return list;
} catch (Exception ex) {
      excepcion = ex;
}
  return null;
}


/**
*
* findByVALOR()
*/

public static List<Vehicles> findByVALOR(Vehicles vehicles,boolean withRelation) {
  excepcion = null;
  try {
      esMensaje =false;

  con= dataGManager.getCon();
  if (con == null) {
      excepcion=new Exception(bundle.getString("msg.noconecction"));
      return null;
  }
       list = new ArrayList<Vehicles>();
      String sql = "select * from vehicles where VALOR='"+vehicles.getVALOR()+"'";
  PreparedStatement psquery = con.prepareStatement(sql,ResultSet.TYPE_SCROLL_INSENSITIVE,
                                      ResultSet.CONCUR_UPDATABLE);
   ResultSet rs = psquery.executeQuery();
   rs.next();
   int x = rs.getRow();
   if (x == 0) {
          excepcion=new Exception(bundle.getString("msg.nofoundrecords") + "vehicles" +"  "+ bundle.getString("msg.withcode"));
          esMensaje =true;
      rs.close();
      psquery.close();
      return null;
   }
   rs.beforeFirst();
   while (rs.next()) {
   
        Vehicles vehicles2 = new Vehicles(
         rs.getLong("IDVEHICULO"),rs.getString("PLACA"),rs.getString("MARCA"),rs.getString("MODELO"),rs.getInt("ANIO"),rs.getString("CHASIS"),rs.getString("CAPACIDAD"),rs.getDouble("VALOR"),rs.getString("MOTOR"),rs.getString("COLOR"),rs.getString("DESCRIPCION"),rs.getString("TIPO"),rs.getString("COMBUSTIBLE"),rs.getString("USO"),rs.getString("ID"),rs.getString("TIPOID"),rs.getString("HIPOTECADO"),rs.getString("SECUESTRADO"),rs.getString("TRASPASO"),rs.getString("ACTIVO"),rs.getString("IDMUNICIPIO"),rs.getString("PAGOINSCRIPCION"),rs.getDate("FECHAINSCRIPCION"),rs.getDate("FECHA"),rs.getString("USERNAME"),rs.getString("LIQUIDACION"),rs.getDate("FECHALIQUIDACION"),rs.getString("MESPAGO"),rs.getString("FIDEICOMISO"));
            
            
       list.add(vehicles2);
    }
    rs.close();
    psquery.close();
    return list;
} catch (Exception ex) {
      excepcion = ex;
}
  return null;
}


/**
*
* findByMOTOR()
*/

public static List<Vehicles> findByMOTOR(Vehicles vehicles,boolean withRelation) {
  excepcion = null;
  try {
      esMensaje =false;

  con= dataGManager.getCon();
  if (con == null) {
      excepcion=new Exception(bundle.getString("msg.noconecction"));
      return null;
  }
       list = new ArrayList<Vehicles>();
      String sql = "select * from vehicles where MOTOR='"+vehicles.getMOTOR()+"'";
  PreparedStatement psquery = con.prepareStatement(sql,ResultSet.TYPE_SCROLL_INSENSITIVE,
                                      ResultSet.CONCUR_UPDATABLE);
   ResultSet rs = psquery.executeQuery();
   rs.next();
   int x = rs.getRow();
   if (x == 0) {
          excepcion=new Exception(bundle.getString("msg.nofoundrecords") + "vehicles" +"  "+ bundle.getString("msg.withcode"));
          esMensaje =true;
      rs.close();
      psquery.close();
      return null;
   }
   rs.beforeFirst();
   while (rs.next()) {
   
        Vehicles vehicles2 = new Vehicles(
         rs.getLong("IDVEHICULO"),rs.getString("PLACA"),rs.getString("MARCA"),rs.getString("MODELO"),rs.getInt("ANIO"),rs.getString("CHASIS"),rs.getString("CAPACIDAD"),rs.getDouble("VALOR"),rs.getString("MOTOR"),rs.getString("COLOR"),rs.getString("DESCRIPCION"),rs.getString("TIPO"),rs.getString("COMBUSTIBLE"),rs.getString("USO"),rs.getString("ID"),rs.getString("TIPOID"),rs.getString("HIPOTECADO"),rs.getString("SECUESTRADO"),rs.getString("TRASPASO"),rs.getString("ACTIVO"),rs.getString("IDMUNICIPIO"),rs.getString("PAGOINSCRIPCION"),rs.getDate("FECHAINSCRIPCION"),rs.getDate("FECHA"),rs.getString("USERNAME"),rs.getString("LIQUIDACION"),rs.getDate("FECHALIQUIDACION"),rs.getString("MESPAGO"),rs.getString("FIDEICOMISO"));
            
            
       list.add(vehicles2);
    }
    rs.close();
    psquery.close();
    return list;
} catch (Exception ex) {
      excepcion = ex;
}
  return null;
}


/**
*
* findByCOLOR()
*/

public static List<Vehicles> findByCOLOR(Vehicles vehicles,boolean withRelation) {
  excepcion = null;
  try {
      esMensaje =false;

  con= dataGManager.getCon();
  if (con == null) {
      excepcion=new Exception(bundle.getString("msg.noconecction"));
      return null;
  }
       list = new ArrayList<Vehicles>();
      String sql = "select * from vehicles where COLOR='"+vehicles.getCOLOR()+"'";
  PreparedStatement psquery = con.prepareStatement(sql,ResultSet.TYPE_SCROLL_INSENSITIVE,
                                      ResultSet.CONCUR_UPDATABLE);
   ResultSet rs = psquery.executeQuery();
   rs.next();
   int x = rs.getRow();
   if (x == 0) {
          excepcion=new Exception(bundle.getString("msg.nofoundrecords") + "vehicles" +"  "+ bundle.getString("msg.withcode"));
          esMensaje =true;
      rs.close();
      psquery.close();
      return null;
   }
   rs.beforeFirst();
   while (rs.next()) {
   
        Vehicles vehicles2 = new Vehicles(
         rs.getLong("IDVEHICULO"),rs.getString("PLACA"),rs.getString("MARCA"),rs.getString("MODELO"),rs.getInt("ANIO"),rs.getString("CHASIS"),rs.getString("CAPACIDAD"),rs.getDouble("VALOR"),rs.getString("MOTOR"),rs.getString("COLOR"),rs.getString("DESCRIPCION"),rs.getString("TIPO"),rs.getString("COMBUSTIBLE"),rs.getString("USO"),rs.getString("ID"),rs.getString("TIPOID"),rs.getString("HIPOTECADO"),rs.getString("SECUESTRADO"),rs.getString("TRASPASO"),rs.getString("ACTIVO"),rs.getString("IDMUNICIPIO"),rs.getString("PAGOINSCRIPCION"),rs.getDate("FECHAINSCRIPCION"),rs.getDate("FECHA"),rs.getString("USERNAME"),rs.getString("LIQUIDACION"),rs.getDate("FECHALIQUIDACION"),rs.getString("MESPAGO"),rs.getString("FIDEICOMISO"));
            
            
       list.add(vehicles2);
    }
    rs.close();
    psquery.close();
    return list;
} catch (Exception ex) {
      excepcion = ex;
}
  return null;
}


/**
*
* findByDESCRIPCION()
*/

public static List<Vehicles> findByDESCRIPCION(Vehicles vehicles,boolean withRelation) {
  excepcion = null;
  try {
      esMensaje =false;

  con= dataGManager.getCon();
  if (con == null) {
      excepcion=new Exception(bundle.getString("msg.noconecction"));
      return null;
  }
       list = new ArrayList<Vehicles>();
      String sql = "select * from vehicles where DESCRIPCION='"+vehicles.getDESCRIPCION()+"'";
  PreparedStatement psquery = con.prepareStatement(sql,ResultSet.TYPE_SCROLL_INSENSITIVE,
                                      ResultSet.CONCUR_UPDATABLE);
   ResultSet rs = psquery.executeQuery();
   rs.next();
   int x = rs.getRow();
   if (x == 0) {
          excepcion=new Exception(bundle.getString("msg.nofoundrecords") + "vehicles" +"  "+ bundle.getString("msg.withcode"));
          esMensaje =true;
      rs.close();
      psquery.close();
      return null;
   }
   rs.beforeFirst();
   while (rs.next()) {
   
        Vehicles vehicles2 = new Vehicles(
         rs.getLong("IDVEHICULO"),rs.getString("PLACA"),rs.getString("MARCA"),rs.getString("MODELO"),rs.getInt("ANIO"),rs.getString("CHASIS"),rs.getString("CAPACIDAD"),rs.getDouble("VALOR"),rs.getString("MOTOR"),rs.getString("COLOR"),rs.getString("DESCRIPCION"),rs.getString("TIPO"),rs.getString("COMBUSTIBLE"),rs.getString("USO"),rs.getString("ID"),rs.getString("TIPOID"),rs.getString("HIPOTECADO"),rs.getString("SECUESTRADO"),rs.getString("TRASPASO"),rs.getString("ACTIVO"),rs.getString("IDMUNICIPIO"),rs.getString("PAGOINSCRIPCION"),rs.getDate("FECHAINSCRIPCION"),rs.getDate("FECHA"),rs.getString("USERNAME"),rs.getString("LIQUIDACION"),rs.getDate("FECHALIQUIDACION"),rs.getString("MESPAGO"),rs.getString("FIDEICOMISO"));
            
            
       list.add(vehicles2);
    }
    rs.close();
    psquery.close();
    return list;
} catch (Exception ex) {
      excepcion = ex;
}
  return null;
}


/**
*
* findByTIPO()
*/

public static List<Vehicles> findByTIPO(Vehicles vehicles,boolean withRelation) {
  excepcion = null;
  try {
      esMensaje =false;

  con= dataGManager.getCon();
  if (con == null) {
      excepcion=new Exception(bundle.getString("msg.noconecction"));
      return null;
  }
       list = new ArrayList<Vehicles>();
      String sql = "select * from vehicles where TIPO='"+vehicles.getTIPO()+"'";
  PreparedStatement psquery = con.prepareStatement(sql,ResultSet.TYPE_SCROLL_INSENSITIVE,
                                      ResultSet.CONCUR_UPDATABLE);
   ResultSet rs = psquery.executeQuery();
   rs.next();
   int x = rs.getRow();
   if (x == 0) {
          excepcion=new Exception(bundle.getString("msg.nofoundrecords") + "vehicles" +"  "+ bundle.getString("msg.withcode"));
          esMensaje =true;
      rs.close();
      psquery.close();
      return null;
   }
   rs.beforeFirst();
   while (rs.next()) {
   
        Vehicles vehicles2 = new Vehicles(
         rs.getLong("IDVEHICULO"),rs.getString("PLACA"),rs.getString("MARCA"),rs.getString("MODELO"),rs.getInt("ANIO"),rs.getString("CHASIS"),rs.getString("CAPACIDAD"),rs.getDouble("VALOR"),rs.getString("MOTOR"),rs.getString("COLOR"),rs.getString("DESCRIPCION"),rs.getString("TIPO"),rs.getString("COMBUSTIBLE"),rs.getString("USO"),rs.getString("ID"),rs.getString("TIPOID"),rs.getString("HIPOTECADO"),rs.getString("SECUESTRADO"),rs.getString("TRASPASO"),rs.getString("ACTIVO"),rs.getString("IDMUNICIPIO"),rs.getString("PAGOINSCRIPCION"),rs.getDate("FECHAINSCRIPCION"),rs.getDate("FECHA"),rs.getString("USERNAME"),rs.getString("LIQUIDACION"),rs.getDate("FECHALIQUIDACION"),rs.getString("MESPAGO"),rs.getString("FIDEICOMISO"));
            
            
       list.add(vehicles2);
    }
    rs.close();
    psquery.close();
    return list;
} catch (Exception ex) {
      excepcion = ex;
}
  return null;
}


/**
*
* findByCOMBUSTIBLE()
*/

public static List<Vehicles> findByCOMBUSTIBLE(Vehicles vehicles,boolean withRelation) {
  excepcion = null;
  try {
      esMensaje =false;

  con= dataGManager.getCon();
  if (con == null) {
      excepcion=new Exception(bundle.getString("msg.noconecction"));
      return null;
  }
       list = new ArrayList<Vehicles>();
      String sql = "select * from vehicles where COMBUSTIBLE='"+vehicles.getCOMBUSTIBLE()+"'";
  PreparedStatement psquery = con.prepareStatement(sql,ResultSet.TYPE_SCROLL_INSENSITIVE,
                                      ResultSet.CONCUR_UPDATABLE);
   ResultSet rs = psquery.executeQuery();
   rs.next();
   int x = rs.getRow();
   if (x == 0) {
          excepcion=new Exception(bundle.getString("msg.nofoundrecords") + "vehicles" +"  "+ bundle.getString("msg.withcode"));
          esMensaje =true;
      rs.close();
      psquery.close();
      return null;
   }
   rs.beforeFirst();
   while (rs.next()) {
   
        Vehicles vehicles2 = new Vehicles(
         rs.getLong("IDVEHICULO"),rs.getString("PLACA"),rs.getString("MARCA"),rs.getString("MODELO"),rs.getInt("ANIO"),rs.getString("CHASIS"),rs.getString("CAPACIDAD"),rs.getDouble("VALOR"),rs.getString("MOTOR"),rs.getString("COLOR"),rs.getString("DESCRIPCION"),rs.getString("TIPO"),rs.getString("COMBUSTIBLE"),rs.getString("USO"),rs.getString("ID"),rs.getString("TIPOID"),rs.getString("HIPOTECADO"),rs.getString("SECUESTRADO"),rs.getString("TRASPASO"),rs.getString("ACTIVO"),rs.getString("IDMUNICIPIO"),rs.getString("PAGOINSCRIPCION"),rs.getDate("FECHAINSCRIPCION"),rs.getDate("FECHA"),rs.getString("USERNAME"),rs.getString("LIQUIDACION"),rs.getDate("FECHALIQUIDACION"),rs.getString("MESPAGO"),rs.getString("FIDEICOMISO"));
            
            
       list.add(vehicles2);
    }
    rs.close();
    psquery.close();
    return list;
} catch (Exception ex) {
      excepcion = ex;
}
  return null;
}


/**
*
* findByUSO()
*/

public static List<Vehicles> findByUSO(Vehicles vehicles,boolean withRelation) {
  excepcion = null;
  try {
      esMensaje =false;

  con= dataGManager.getCon();
  if (con == null) {
      excepcion=new Exception(bundle.getString("msg.noconecction"));
      return null;
  }
       list = new ArrayList<Vehicles>();
      String sql = "select * from vehicles where USO='"+vehicles.getUSO()+"'";
  PreparedStatement psquery = con.prepareStatement(sql,ResultSet.TYPE_SCROLL_INSENSITIVE,
                                      ResultSet.CONCUR_UPDATABLE);
   ResultSet rs = psquery.executeQuery();
   rs.next();
   int x = rs.getRow();
   if (x == 0) {
          excepcion=new Exception(bundle.getString("msg.nofoundrecords") + "vehicles" +"  "+ bundle.getString("msg.withcode"));
          esMensaje =true;
      rs.close();
      psquery.close();
      return null;
   }
   rs.beforeFirst();
   while (rs.next()) {
   
        Vehicles vehicles2 = new Vehicles(
         rs.getLong("IDVEHICULO"),rs.getString("PLACA"),rs.getString("MARCA"),rs.getString("MODELO"),rs.getInt("ANIO"),rs.getString("CHASIS"),rs.getString("CAPACIDAD"),rs.getDouble("VALOR"),rs.getString("MOTOR"),rs.getString("COLOR"),rs.getString("DESCRIPCION"),rs.getString("TIPO"),rs.getString("COMBUSTIBLE"),rs.getString("USO"),rs.getString("ID"),rs.getString("TIPOID"),rs.getString("HIPOTECADO"),rs.getString("SECUESTRADO"),rs.getString("TRASPASO"),rs.getString("ACTIVO"),rs.getString("IDMUNICIPIO"),rs.getString("PAGOINSCRIPCION"),rs.getDate("FECHAINSCRIPCION"),rs.getDate("FECHA"),rs.getString("USERNAME"),rs.getString("LIQUIDACION"),rs.getDate("FECHALIQUIDACION"),rs.getString("MESPAGO"),rs.getString("FIDEICOMISO"));
            
            
       list.add(vehicles2);
    }
    rs.close();
    psquery.close();
    return list;
} catch (Exception ex) {
      excepcion = ex;
}
  return null;
}


/**
*
* findByID()
*/

public static List<Vehicles> findByID(Vehicles vehicles,boolean withRelation) {
  excepcion = null;
  try {
      esMensaje =false;

  con= dataGManager.getCon();
  if (con == null) {
      excepcion=new Exception(bundle.getString("msg.noconecction"));
      return null;
  }
       list = new ArrayList<Vehicles>();
      String sql = "select * from vehicles where ID='"+vehicles.getID()+"'";
  PreparedStatement psquery = con.prepareStatement(sql,ResultSet.TYPE_SCROLL_INSENSITIVE,
                                      ResultSet.CONCUR_UPDATABLE);
   ResultSet rs = psquery.executeQuery();
   rs.next();
   int x = rs.getRow();
   if (x == 0) {
          excepcion=new Exception(bundle.getString("msg.nofoundrecords") + "vehicles" +"  "+ bundle.getString("msg.withcode"));
          esMensaje =true;
      rs.close();
      psquery.close();
      return null;
   }
   rs.beforeFirst();
   while (rs.next()) {
   
        Vehicles vehicles2 = new Vehicles(
         rs.getLong("IDVEHICULO"),rs.getString("PLACA"),rs.getString("MARCA"),rs.getString("MODELO"),rs.getInt("ANIO"),rs.getString("CHASIS"),rs.getString("CAPACIDAD"),rs.getDouble("VALOR"),rs.getString("MOTOR"),rs.getString("COLOR"),rs.getString("DESCRIPCION"),rs.getString("TIPO"),rs.getString("COMBUSTIBLE"),rs.getString("USO"),rs.getString("ID"),rs.getString("TIPOID"),rs.getString("HIPOTECADO"),rs.getString("SECUESTRADO"),rs.getString("TRASPASO"),rs.getString("ACTIVO"),rs.getString("IDMUNICIPIO"),rs.getString("PAGOINSCRIPCION"),rs.getDate("FECHAINSCRIPCION"),rs.getDate("FECHA"),rs.getString("USERNAME"),rs.getString("LIQUIDACION"),rs.getDate("FECHALIQUIDACION"),rs.getString("MESPAGO"),rs.getString("FIDEICOMISO"));
            
            
       list.add(vehicles2);
    }
    rs.close();
    psquery.close();
    return list;
} catch (Exception ex) {
      excepcion = ex;
}
  return null;
}


/**
*
* findByTIPOID()
*/

public static List<Vehicles> findByTIPOID(Vehicles vehicles,boolean withRelation) {
  excepcion = null;
  try {
      esMensaje =false;

  con= dataGManager.getCon();
  if (con == null) {
      excepcion=new Exception(bundle.getString("msg.noconecction"));
      return null;
  }
       list = new ArrayList<Vehicles>();
      String sql = "select * from vehicles where TIPOID='"+vehicles.getTIPOID()+"'";
  PreparedStatement psquery = con.prepareStatement(sql,ResultSet.TYPE_SCROLL_INSENSITIVE,
                                      ResultSet.CONCUR_UPDATABLE);
   ResultSet rs = psquery.executeQuery();
   rs.next();
   int x = rs.getRow();
   if (x == 0) {
          excepcion=new Exception(bundle.getString("msg.nofoundrecords") + "vehicles" +"  "+ bundle.getString("msg.withcode"));
          esMensaje =true;
      rs.close();
      psquery.close();
      return null;
   }
   rs.beforeFirst();
   while (rs.next()) {
   
        Vehicles vehicles2 = new Vehicles(
         rs.getLong("IDVEHICULO"),rs.getString("PLACA"),rs.getString("MARCA"),rs.getString("MODELO"),rs.getInt("ANIO"),rs.getString("CHASIS"),rs.getString("CAPACIDAD"),rs.getDouble("VALOR"),rs.getString("MOTOR"),rs.getString("COLOR"),rs.getString("DESCRIPCION"),rs.getString("TIPO"),rs.getString("COMBUSTIBLE"),rs.getString("USO"),rs.getString("ID"),rs.getString("TIPOID"),rs.getString("HIPOTECADO"),rs.getString("SECUESTRADO"),rs.getString("TRASPASO"),rs.getString("ACTIVO"),rs.getString("IDMUNICIPIO"),rs.getString("PAGOINSCRIPCION"),rs.getDate("FECHAINSCRIPCION"),rs.getDate("FECHA"),rs.getString("USERNAME"),rs.getString("LIQUIDACION"),rs.getDate("FECHALIQUIDACION"),rs.getString("MESPAGO"),rs.getString("FIDEICOMISO"));
            
            
       list.add(vehicles2);
    }
    rs.close();
    psquery.close();
    return list;
} catch (Exception ex) {
      excepcion = ex;
}
  return null;
}


/**
*
* findByHIPOTECADO()
*/

public static List<Vehicles> findByHIPOTECADO(Vehicles vehicles,boolean withRelation) {
  excepcion = null;
  try {
      esMensaje =false;

  con= dataGManager.getCon();
  if (con == null) {
      excepcion=new Exception(bundle.getString("msg.noconecction"));
      return null;
  }
       list = new ArrayList<Vehicles>();
      String sql = "select * from vehicles where HIPOTECADO='"+vehicles.getHIPOTECADO()+"'";
  PreparedStatement psquery = con.prepareStatement(sql,ResultSet.TYPE_SCROLL_INSENSITIVE,
                                      ResultSet.CONCUR_UPDATABLE);
   ResultSet rs = psquery.executeQuery();
   rs.next();
   int x = rs.getRow();
   if (x == 0) {
          excepcion=new Exception(bundle.getString("msg.nofoundrecords") + "vehicles" +"  "+ bundle.getString("msg.withcode"));
          esMensaje =true;
      rs.close();
      psquery.close();
      return null;
   }
   rs.beforeFirst();
   while (rs.next()) {
   
        Vehicles vehicles2 = new Vehicles(
         rs.getLong("IDVEHICULO"),rs.getString("PLACA"),rs.getString("MARCA"),rs.getString("MODELO"),rs.getInt("ANIO"),rs.getString("CHASIS"),rs.getString("CAPACIDAD"),rs.getDouble("VALOR"),rs.getString("MOTOR"),rs.getString("COLOR"),rs.getString("DESCRIPCION"),rs.getString("TIPO"),rs.getString("COMBUSTIBLE"),rs.getString("USO"),rs.getString("ID"),rs.getString("TIPOID"),rs.getString("HIPOTECADO"),rs.getString("SECUESTRADO"),rs.getString("TRASPASO"),rs.getString("ACTIVO"),rs.getString("IDMUNICIPIO"),rs.getString("PAGOINSCRIPCION"),rs.getDate("FECHAINSCRIPCION"),rs.getDate("FECHA"),rs.getString("USERNAME"),rs.getString("LIQUIDACION"),rs.getDate("FECHALIQUIDACION"),rs.getString("MESPAGO"),rs.getString("FIDEICOMISO"));
            
            
       list.add(vehicles2);
    }
    rs.close();
    psquery.close();
    return list;
} catch (Exception ex) {
      excepcion = ex;
}
  return null;
}


/**
*
* findBySECUESTRADO()
*/

public static List<Vehicles> findBySECUESTRADO(Vehicles vehicles,boolean withRelation) {
  excepcion = null;
  try {
      esMensaje =false;

  con= dataGManager.getCon();
  if (con == null) {
      excepcion=new Exception(bundle.getString("msg.noconecction"));
      return null;
  }
       list = new ArrayList<Vehicles>();
      String sql = "select * from vehicles where SECUESTRADO='"+vehicles.getSECUESTRADO()+"'";
  PreparedStatement psquery = con.prepareStatement(sql,ResultSet.TYPE_SCROLL_INSENSITIVE,
                                      ResultSet.CONCUR_UPDATABLE);
   ResultSet rs = psquery.executeQuery();
   rs.next();
   int x = rs.getRow();
   if (x == 0) {
          excepcion=new Exception(bundle.getString("msg.nofoundrecords") + "vehicles" +"  "+ bundle.getString("msg.withcode"));
          esMensaje =true;
      rs.close();
      psquery.close();
      return null;
   }
   rs.beforeFirst();
   while (rs.next()) {
   
        Vehicles vehicles2 = new Vehicles(
         rs.getLong("IDVEHICULO"),rs.getString("PLACA"),rs.getString("MARCA"),rs.getString("MODELO"),rs.getInt("ANIO"),rs.getString("CHASIS"),rs.getString("CAPACIDAD"),rs.getDouble("VALOR"),rs.getString("MOTOR"),rs.getString("COLOR"),rs.getString("DESCRIPCION"),rs.getString("TIPO"),rs.getString("COMBUSTIBLE"),rs.getString("USO"),rs.getString("ID"),rs.getString("TIPOID"),rs.getString("HIPOTECADO"),rs.getString("SECUESTRADO"),rs.getString("TRASPASO"),rs.getString("ACTIVO"),rs.getString("IDMUNICIPIO"),rs.getString("PAGOINSCRIPCION"),rs.getDate("FECHAINSCRIPCION"),rs.getDate("FECHA"),rs.getString("USERNAME"),rs.getString("LIQUIDACION"),rs.getDate("FECHALIQUIDACION"),rs.getString("MESPAGO"),rs.getString("FIDEICOMISO"));
            
            
       list.add(vehicles2);
    }
    rs.close();
    psquery.close();
    return list;
} catch (Exception ex) {
      excepcion = ex;
}
  return null;
}


/**
*
* findByTRASPASO()
*/

public static List<Vehicles> findByTRASPASO(Vehicles vehicles,boolean withRelation) {
  excepcion = null;
  try {
      esMensaje =false;

  con= dataGManager.getCon();
  if (con == null) {
      excepcion=new Exception(bundle.getString("msg.noconecction"));
      return null;
  }
       list = new ArrayList<Vehicles>();
      String sql = "select * from vehicles where TRASPASO='"+vehicles.getTRASPASO()+"'";
  PreparedStatement psquery = con.prepareStatement(sql,ResultSet.TYPE_SCROLL_INSENSITIVE,
                                      ResultSet.CONCUR_UPDATABLE);
   ResultSet rs = psquery.executeQuery();
   rs.next();
   int x = rs.getRow();
   if (x == 0) {
          excepcion=new Exception(bundle.getString("msg.nofoundrecords") + "vehicles" +"  "+ bundle.getString("msg.withcode"));
          esMensaje =true;
      rs.close();
      psquery.close();
      return null;
   }
   rs.beforeFirst();
   while (rs.next()) {
   
        Vehicles vehicles2 = new Vehicles(
         rs.getLong("IDVEHICULO"),rs.getString("PLACA"),rs.getString("MARCA"),rs.getString("MODELO"),rs.getInt("ANIO"),rs.getString("CHASIS"),rs.getString("CAPACIDAD"),rs.getDouble("VALOR"),rs.getString("MOTOR"),rs.getString("COLOR"),rs.getString("DESCRIPCION"),rs.getString("TIPO"),rs.getString("COMBUSTIBLE"),rs.getString("USO"),rs.getString("ID"),rs.getString("TIPOID"),rs.getString("HIPOTECADO"),rs.getString("SECUESTRADO"),rs.getString("TRASPASO"),rs.getString("ACTIVO"),rs.getString("IDMUNICIPIO"),rs.getString("PAGOINSCRIPCION"),rs.getDate("FECHAINSCRIPCION"),rs.getDate("FECHA"),rs.getString("USERNAME"),rs.getString("LIQUIDACION"),rs.getDate("FECHALIQUIDACION"),rs.getString("MESPAGO"),rs.getString("FIDEICOMISO"));
            
            
       list.add(vehicles2);
    }
    rs.close();
    psquery.close();
    return list;
} catch (Exception ex) {
      excepcion = ex;
}
  return null;
}


/**
*
* findByACTIVO()
*/

public static List<Vehicles> findByACTIVO(Vehicles vehicles,boolean withRelation) {
  excepcion = null;
  try {
      esMensaje =false;

  con= dataGManager.getCon();
  if (con == null) {
      excepcion=new Exception(bundle.getString("msg.noconecction"));
      return null;
  }
       list = new ArrayList<Vehicles>();
      String sql = "select * from vehicles where ACTIVO='"+vehicles.getACTIVO()+"'";
  PreparedStatement psquery = con.prepareStatement(sql,ResultSet.TYPE_SCROLL_INSENSITIVE,
                                      ResultSet.CONCUR_UPDATABLE);
   ResultSet rs = psquery.executeQuery();
   rs.next();
   int x = rs.getRow();
   if (x == 0) {
          excepcion=new Exception(bundle.getString("msg.nofoundrecords") + "vehicles" +"  "+ bundle.getString("msg.withcode"));
          esMensaje =true;
      rs.close();
      psquery.close();
      return null;
   }
   rs.beforeFirst();
   while (rs.next()) {
   
        Vehicles vehicles2 = new Vehicles(
         rs.getLong("IDVEHICULO"),rs.getString("PLACA"),rs.getString("MARCA"),rs.getString("MODELO"),rs.getInt("ANIO"),rs.getString("CHASIS"),rs.getString("CAPACIDAD"),rs.getDouble("VALOR"),rs.getString("MOTOR"),rs.getString("COLOR"),rs.getString("DESCRIPCION"),rs.getString("TIPO"),rs.getString("COMBUSTIBLE"),rs.getString("USO"),rs.getString("ID"),rs.getString("TIPOID"),rs.getString("HIPOTECADO"),rs.getString("SECUESTRADO"),rs.getString("TRASPASO"),rs.getString("ACTIVO"),rs.getString("IDMUNICIPIO"),rs.getString("PAGOINSCRIPCION"),rs.getDate("FECHAINSCRIPCION"),rs.getDate("FECHA"),rs.getString("USERNAME"),rs.getString("LIQUIDACION"),rs.getDate("FECHALIQUIDACION"),rs.getString("MESPAGO"),rs.getString("FIDEICOMISO"));
            
            
       list.add(vehicles2);
    }
    rs.close();
    psquery.close();
    return list;
} catch (Exception ex) {
      excepcion = ex;
}
  return null;
}


/**
*
* findByIDMUNICIPIO()
*/

public static List<Vehicles> findByIDMUNICIPIO(Vehicles vehicles,boolean withRelation) {
  excepcion = null;
  try {
      esMensaje =false;

  con= dataGManager.getCon();
  if (con == null) {
      excepcion=new Exception(bundle.getString("msg.noconecction"));
      return null;
  }
       list = new ArrayList<Vehicles>();
      String sql = "select * from vehicles where IDMUNICIPIO='"+vehicles.getIDMUNICIPIO()+"'";
  PreparedStatement psquery = con.prepareStatement(sql,ResultSet.TYPE_SCROLL_INSENSITIVE,
                                      ResultSet.CONCUR_UPDATABLE);
   ResultSet rs = psquery.executeQuery();
   rs.next();
   int x = rs.getRow();
   if (x == 0) {
          excepcion=new Exception(bundle.getString("msg.nofoundrecords") + "vehicles" +"  "+ bundle.getString("msg.withcode"));
          esMensaje =true;
      rs.close();
      psquery.close();
      return null;
   }
   rs.beforeFirst();
   while (rs.next()) {
   
        Vehicles vehicles2 = new Vehicles(
         rs.getLong("IDVEHICULO"),rs.getString("PLACA"),rs.getString("MARCA"),rs.getString("MODELO"),rs.getInt("ANIO"),rs.getString("CHASIS"),rs.getString("CAPACIDAD"),rs.getDouble("VALOR"),rs.getString("MOTOR"),rs.getString("COLOR"),rs.getString("DESCRIPCION"),rs.getString("TIPO"),rs.getString("COMBUSTIBLE"),rs.getString("USO"),rs.getString("ID"),rs.getString("TIPOID"),rs.getString("HIPOTECADO"),rs.getString("SECUESTRADO"),rs.getString("TRASPASO"),rs.getString("ACTIVO"),rs.getString("IDMUNICIPIO"),rs.getString("PAGOINSCRIPCION"),rs.getDate("FECHAINSCRIPCION"),rs.getDate("FECHA"),rs.getString("USERNAME"),rs.getString("LIQUIDACION"),rs.getDate("FECHALIQUIDACION"),rs.getString("MESPAGO"),rs.getString("FIDEICOMISO"));
            
            
       list.add(vehicles2);
    }
    rs.close();
    psquery.close();
    return list;
} catch (Exception ex) {
      excepcion = ex;
}
  return null;
}


/**
*
* findByPAGOINSCRIPCION()
*/

public static List<Vehicles> findByPAGOINSCRIPCION(Vehicles vehicles,boolean withRelation) {
  excepcion = null;
  try {
      esMensaje =false;

  con= dataGManager.getCon();
  if (con == null) {
      excepcion=new Exception(bundle.getString("msg.noconecction"));
      return null;
  }
       list = new ArrayList<Vehicles>();
      String sql = "select * from vehicles where PAGOINSCRIPCION='"+vehicles.getPAGOINSCRIPCION()+"'";
  PreparedStatement psquery = con.prepareStatement(sql,ResultSet.TYPE_SCROLL_INSENSITIVE,
                                      ResultSet.CONCUR_UPDATABLE);
   ResultSet rs = psquery.executeQuery();
   rs.next();
   int x = rs.getRow();
   if (x == 0) {
          excepcion=new Exception(bundle.getString("msg.nofoundrecords") + "vehicles" +"  "+ bundle.getString("msg.withcode"));
          esMensaje =true;
      rs.close();
      psquery.close();
      return null;
   }
   rs.beforeFirst();
   while (rs.next()) {
   
        Vehicles vehicles2 = new Vehicles(
         rs.getLong("IDVEHICULO"),rs.getString("PLACA"),rs.getString("MARCA"),rs.getString("MODELO"),rs.getInt("ANIO"),rs.getString("CHASIS"),rs.getString("CAPACIDAD"),rs.getDouble("VALOR"),rs.getString("MOTOR"),rs.getString("COLOR"),rs.getString("DESCRIPCION"),rs.getString("TIPO"),rs.getString("COMBUSTIBLE"),rs.getString("USO"),rs.getString("ID"),rs.getString("TIPOID"),rs.getString("HIPOTECADO"),rs.getString("SECUESTRADO"),rs.getString("TRASPASO"),rs.getString("ACTIVO"),rs.getString("IDMUNICIPIO"),rs.getString("PAGOINSCRIPCION"),rs.getDate("FECHAINSCRIPCION"),rs.getDate("FECHA"),rs.getString("USERNAME"),rs.getString("LIQUIDACION"),rs.getDate("FECHALIQUIDACION"),rs.getString("MESPAGO"),rs.getString("FIDEICOMISO"));
            
            
       list.add(vehicles2);
    }
    rs.close();
    psquery.close();
    return list;
} catch (Exception ex) {
      excepcion = ex;
}
  return null;
}


/**
*
* findByFECHAINSCRIPCION()
*/

public static List<Vehicles> findByFECHAINSCRIPCION(Vehicles vehicles,boolean withRelation) {
  excepcion = null;
  try {
      esMensaje =false;

  con= dataGManager.getCon();
  if (con == null) {
      excepcion=new Exception(bundle.getString("msg.noconecction"));
      return null;
  }
       list = new ArrayList<Vehicles>();
      String sql = "select * from vehicles where FECHAINSCRIPCION='"+vehicles.getFECHAINSCRIPCION()+"'";
  PreparedStatement psquery = con.prepareStatement(sql,ResultSet.TYPE_SCROLL_INSENSITIVE,
                                      ResultSet.CONCUR_UPDATABLE);
   ResultSet rs = psquery.executeQuery();
   rs.next();
   int x = rs.getRow();
   if (x == 0) {
          excepcion=new Exception(bundle.getString("msg.nofoundrecords") + "vehicles" +"  "+ bundle.getString("msg.withcode"));
          esMensaje =true;
      rs.close();
      psquery.close();
      return null;
   }
   rs.beforeFirst();
   while (rs.next()) {
   
        Vehicles vehicles2 = new Vehicles(
         rs.getLong("IDVEHICULO"),rs.getString("PLACA"),rs.getString("MARCA"),rs.getString("MODELO"),rs.getInt("ANIO"),rs.getString("CHASIS"),rs.getString("CAPACIDAD"),rs.getDouble("VALOR"),rs.getString("MOTOR"),rs.getString("COLOR"),rs.getString("DESCRIPCION"),rs.getString("TIPO"),rs.getString("COMBUSTIBLE"),rs.getString("USO"),rs.getString("ID"),rs.getString("TIPOID"),rs.getString("HIPOTECADO"),rs.getString("SECUESTRADO"),rs.getString("TRASPASO"),rs.getString("ACTIVO"),rs.getString("IDMUNICIPIO"),rs.getString("PAGOINSCRIPCION"),rs.getDate("FECHAINSCRIPCION"),rs.getDate("FECHA"),rs.getString("USERNAME"),rs.getString("LIQUIDACION"),rs.getDate("FECHALIQUIDACION"),rs.getString("MESPAGO"),rs.getString("FIDEICOMISO"));
            
            
       list.add(vehicles2);
    }
    rs.close();
    psquery.close();
    return list;
} catch (Exception ex) {
      excepcion = ex;
}
  return null;
}


/**
*
* findByFECHA()
*/

public static List<Vehicles> findByFECHA(Vehicles vehicles,boolean withRelation) {
  excepcion = null;
  try {
      esMensaje =false;

  con= dataGManager.getCon();
  if (con == null) {
      excepcion=new Exception(bundle.getString("msg.noconecction"));
      return null;
  }
       list = new ArrayList<Vehicles>();
      String sql = "select * from vehicles where FECHA='"+vehicles.getFECHA()+"'";
  PreparedStatement psquery = con.prepareStatement(sql,ResultSet.TYPE_SCROLL_INSENSITIVE,
                                      ResultSet.CONCUR_UPDATABLE);
   ResultSet rs = psquery.executeQuery();
   rs.next();
   int x = rs.getRow();
   if (x == 0) {
          excepcion=new Exception(bundle.getString("msg.nofoundrecords") + "vehicles" +"  "+ bundle.getString("msg.withcode"));
          esMensaje =true;
      rs.close();
      psquery.close();
      return null;
   }
   rs.beforeFirst();
   while (rs.next()) {
   
        Vehicles vehicles2 = new Vehicles(
         rs.getLong("IDVEHICULO"),rs.getString("PLACA"),rs.getString("MARCA"),rs.getString("MODELO"),rs.getInt("ANIO"),rs.getString("CHASIS"),rs.getString("CAPACIDAD"),rs.getDouble("VALOR"),rs.getString("MOTOR"),rs.getString("COLOR"),rs.getString("DESCRIPCION"),rs.getString("TIPO"),rs.getString("COMBUSTIBLE"),rs.getString("USO"),rs.getString("ID"),rs.getString("TIPOID"),rs.getString("HIPOTECADO"),rs.getString("SECUESTRADO"),rs.getString("TRASPASO"),rs.getString("ACTIVO"),rs.getString("IDMUNICIPIO"),rs.getString("PAGOINSCRIPCION"),rs.getDate("FECHAINSCRIPCION"),rs.getDate("FECHA"),rs.getString("USERNAME"),rs.getString("LIQUIDACION"),rs.getDate("FECHALIQUIDACION"),rs.getString("MESPAGO"),rs.getString("FIDEICOMISO"));
            
            
       list.add(vehicles2);
    }
    rs.close();
    psquery.close();
    return list;
} catch (Exception ex) {
      excepcion = ex;
}
  return null;
}


/**
*
* findByUSERNAME()
*/

public static List<Vehicles> findByUSERNAME(Vehicles vehicles,boolean withRelation) {
  excepcion = null;
  try {
      esMensaje =false;

  con= dataGManager.getCon();
  if (con == null) {
      excepcion=new Exception(bundle.getString("msg.noconecction"));
      return null;
  }
       list = new ArrayList<Vehicles>();
      String sql = "select * from vehicles where USERNAME='"+vehicles.getUSERNAME()+"'";
  PreparedStatement psquery = con.prepareStatement(sql,ResultSet.TYPE_SCROLL_INSENSITIVE,
                                      ResultSet.CONCUR_UPDATABLE);
   ResultSet rs = psquery.executeQuery();
   rs.next();
   int x = rs.getRow();
   if (x == 0) {
          excepcion=new Exception(bundle.getString("msg.nofoundrecords") + "vehicles" +"  "+ bundle.getString("msg.withcode"));
          esMensaje =true;
      rs.close();
      psquery.close();
      return null;
   }
   rs.beforeFirst();
   while (rs.next()) {
   
        Vehicles vehicles2 = new Vehicles(
         rs.getLong("IDVEHICULO"),rs.getString("PLACA"),rs.getString("MARCA"),rs.getString("MODELO"),rs.getInt("ANIO"),rs.getString("CHASIS"),rs.getString("CAPACIDAD"),rs.getDouble("VALOR"),rs.getString("MOTOR"),rs.getString("COLOR"),rs.getString("DESCRIPCION"),rs.getString("TIPO"),rs.getString("COMBUSTIBLE"),rs.getString("USO"),rs.getString("ID"),rs.getString("TIPOID"),rs.getString("HIPOTECADO"),rs.getString("SECUESTRADO"),rs.getString("TRASPASO"),rs.getString("ACTIVO"),rs.getString("IDMUNICIPIO"),rs.getString("PAGOINSCRIPCION"),rs.getDate("FECHAINSCRIPCION"),rs.getDate("FECHA"),rs.getString("USERNAME"),rs.getString("LIQUIDACION"),rs.getDate("FECHALIQUIDACION"),rs.getString("MESPAGO"),rs.getString("FIDEICOMISO"));
            
            
       list.add(vehicles2);
    }
    rs.close();
    psquery.close();
    return list;
} catch (Exception ex) {
      excepcion = ex;
}
  return null;
}


/**
*
* findByLIQUIDACION()
*/

public static List<Vehicles> findByLIQUIDACION(Vehicles vehicles,boolean withRelation) {
  excepcion = null;
  try {
      esMensaje =false;

  con= dataGManager.getCon();
  if (con == null) {
      excepcion=new Exception(bundle.getString("msg.noconecction"));
      return null;
  }
       list = new ArrayList<Vehicles>();
      String sql = "select * from vehicles where LIQUIDACION='"+vehicles.getLIQUIDACION()+"'";
  PreparedStatement psquery = con.prepareStatement(sql,ResultSet.TYPE_SCROLL_INSENSITIVE,
                                      ResultSet.CONCUR_UPDATABLE);
   ResultSet rs = psquery.executeQuery();
   rs.next();
   int x = rs.getRow();
   if (x == 0) {
          excepcion=new Exception(bundle.getString("msg.nofoundrecords") + "vehicles" +"  "+ bundle.getString("msg.withcode"));
          esMensaje =true;
      rs.close();
      psquery.close();
      return null;
   }
   rs.beforeFirst();
   while (rs.next()) {
   
        Vehicles vehicles2 = new Vehicles(
         rs.getLong("IDVEHICULO"),rs.getString("PLACA"),rs.getString("MARCA"),rs.getString("MODELO"),rs.getInt("ANIO"),rs.getString("CHASIS"),rs.getString("CAPACIDAD"),rs.getDouble("VALOR"),rs.getString("MOTOR"),rs.getString("COLOR"),rs.getString("DESCRIPCION"),rs.getString("TIPO"),rs.getString("COMBUSTIBLE"),rs.getString("USO"),rs.getString("ID"),rs.getString("TIPOID"),rs.getString("HIPOTECADO"),rs.getString("SECUESTRADO"),rs.getString("TRASPASO"),rs.getString("ACTIVO"),rs.getString("IDMUNICIPIO"),rs.getString("PAGOINSCRIPCION"),rs.getDate("FECHAINSCRIPCION"),rs.getDate("FECHA"),rs.getString("USERNAME"),rs.getString("LIQUIDACION"),rs.getDate("FECHALIQUIDACION"),rs.getString("MESPAGO"),rs.getString("FIDEICOMISO"));
            
            
       list.add(vehicles2);
    }
    rs.close();
    psquery.close();
    return list;
} catch (Exception ex) {
      excepcion = ex;
}
  return null;
}


/**
*
* findByFECHALIQUIDACION()
*/

public static List<Vehicles> findByFECHALIQUIDACION(Vehicles vehicles,boolean withRelation) {
  excepcion = null;
  try {
      esMensaje =false;

  con= dataGManager.getCon();
  if (con == null) {
      excepcion=new Exception(bundle.getString("msg.noconecction"));
      return null;
  }
       list = new ArrayList<Vehicles>();
      String sql = "select * from vehicles where FECHALIQUIDACION='"+vehicles.getFECHALIQUIDACION()+"'";
  PreparedStatement psquery = con.prepareStatement(sql,ResultSet.TYPE_SCROLL_INSENSITIVE,
                                      ResultSet.CONCUR_UPDATABLE);
   ResultSet rs = psquery.executeQuery();
   rs.next();
   int x = rs.getRow();
   if (x == 0) {
          excepcion=new Exception(bundle.getString("msg.nofoundrecords") + "vehicles" +"  "+ bundle.getString("msg.withcode"));
          esMensaje =true;
      rs.close();
      psquery.close();
      return null;
   }
   rs.beforeFirst();
   while (rs.next()) {
   
        Vehicles vehicles2 = new Vehicles(
         rs.getLong("IDVEHICULO"),rs.getString("PLACA"),rs.getString("MARCA"),rs.getString("MODELO"),rs.getInt("ANIO"),rs.getString("CHASIS"),rs.getString("CAPACIDAD"),rs.getDouble("VALOR"),rs.getString("MOTOR"),rs.getString("COLOR"),rs.getString("DESCRIPCION"),rs.getString("TIPO"),rs.getString("COMBUSTIBLE"),rs.getString("USO"),rs.getString("ID"),rs.getString("TIPOID"),rs.getString("HIPOTECADO"),rs.getString("SECUESTRADO"),rs.getString("TRASPASO"),rs.getString("ACTIVO"),rs.getString("IDMUNICIPIO"),rs.getString("PAGOINSCRIPCION"),rs.getDate("FECHAINSCRIPCION"),rs.getDate("FECHA"),rs.getString("USERNAME"),rs.getString("LIQUIDACION"),rs.getDate("FECHALIQUIDACION"),rs.getString("MESPAGO"),rs.getString("FIDEICOMISO"));
            
            
       list.add(vehicles2);
    }
    rs.close();
    psquery.close();
    return list;
} catch (Exception ex) {
      excepcion = ex;
}
  return null;
}


/**
*
* findByMESPAGO()
*/

public static List<Vehicles> findByMESPAGO(Vehicles vehicles,boolean withRelation) {
  excepcion = null;
  try {
      esMensaje =false;

  con= dataGManager.getCon();
  if (con == null) {
      excepcion=new Exception(bundle.getString("msg.noconecction"));
      return null;
  }
       list = new ArrayList<Vehicles>();
      String sql = "select * from vehicles where MESPAGO='"+vehicles.getMESPAGO()+"'";
  PreparedStatement psquery = con.prepareStatement(sql,ResultSet.TYPE_SCROLL_INSENSITIVE,
                                      ResultSet.CONCUR_UPDATABLE);
   ResultSet rs = psquery.executeQuery();
   rs.next();
   int x = rs.getRow();
   if (x == 0) {
          excepcion=new Exception(bundle.getString("msg.nofoundrecords") + "vehicles" +"  "+ bundle.getString("msg.withcode"));
          esMensaje =true;
      rs.close();
      psquery.close();
      return null;
   }
   rs.beforeFirst();
   while (rs.next()) {
   
        Vehicles vehicles2 = new Vehicles(
         rs.getLong("IDVEHICULO"),rs.getString("PLACA"),rs.getString("MARCA"),rs.getString("MODELO"),rs.getInt("ANIO"),rs.getString("CHASIS"),rs.getString("CAPACIDAD"),rs.getDouble("VALOR"),rs.getString("MOTOR"),rs.getString("COLOR"),rs.getString("DESCRIPCION"),rs.getString("TIPO"),rs.getString("COMBUSTIBLE"),rs.getString("USO"),rs.getString("ID"),rs.getString("TIPOID"),rs.getString("HIPOTECADO"),rs.getString("SECUESTRADO"),rs.getString("TRASPASO"),rs.getString("ACTIVO"),rs.getString("IDMUNICIPIO"),rs.getString("PAGOINSCRIPCION"),rs.getDate("FECHAINSCRIPCION"),rs.getDate("FECHA"),rs.getString("USERNAME"),rs.getString("LIQUIDACION"),rs.getDate("FECHALIQUIDACION"),rs.getString("MESPAGO"),rs.getString("FIDEICOMISO"));
            
            
       list.add(vehicles2);
    }
    rs.close();
    psquery.close();
    return list;
} catch (Exception ex) {
      excepcion = ex;
}
  return null;
}


/**
*
* findByFIDEICOMISO()
*/

public static List<Vehicles> findByFIDEICOMISO(Vehicles vehicles,boolean withRelation) {
  excepcion = null;
  try {
      esMensaje =false;

  con= dataGManager.getCon();
  if (con == null) {
      excepcion=new Exception(bundle.getString("msg.noconecction"));
      return null;
  }
       list = new ArrayList<Vehicles>();
      String sql = "select * from vehicles where FIDEICOMISO='"+vehicles.getFIDEICOMISO()+"'";
  PreparedStatement psquery = con.prepareStatement(sql,ResultSet.TYPE_SCROLL_INSENSITIVE,
                                      ResultSet.CONCUR_UPDATABLE);
   ResultSet rs = psquery.executeQuery();
   rs.next();
   int x = rs.getRow();
   if (x == 0) {
          excepcion=new Exception(bundle.getString("msg.nofoundrecords") + "vehicles" +"  "+ bundle.getString("msg.withcode"));
          esMensaje =true;
      rs.close();
      psquery.close();
      return null;
   }
   rs.beforeFirst();
   while (rs.next()) {
   
        Vehicles vehicles2 = new Vehicles(
         rs.getLong("IDVEHICULO"),rs.getString("PLACA"),rs.getString("MARCA"),rs.getString("MODELO"),rs.getInt("ANIO"),rs.getString("CHASIS"),rs.getString("CAPACIDAD"),rs.getDouble("VALOR"),rs.getString("MOTOR"),rs.getString("COLOR"),rs.getString("DESCRIPCION"),rs.getString("TIPO"),rs.getString("COMBUSTIBLE"),rs.getString("USO"),rs.getString("ID"),rs.getString("TIPOID"),rs.getString("HIPOTECADO"),rs.getString("SECUESTRADO"),rs.getString("TRASPASO"),rs.getString("ACTIVO"),rs.getString("IDMUNICIPIO"),rs.getString("PAGOINSCRIPCION"),rs.getDate("FECHAINSCRIPCION"),rs.getDate("FECHA"),rs.getString("USERNAME"),rs.getString("LIQUIDACION"),rs.getDate("FECHALIQUIDACION"),rs.getString("MESPAGO"),rs.getString("FIDEICOMISO"));
            
            
       list.add(vehicles2);
    }
    rs.close();
    psquery.close();
    return list;
} catch (Exception ex) {
      excepcion = ex;
}
  return null;
}


/**
*
* locateByParameters()
*/

public static List<Vehicles> locateByParameters(Map parametros,boolean withRelation) {
  excepcion = null;
  try {
      esMensaje =false;

  con= dataGManager.getCon();
  if (con == null) {
      excepcion=new Exception(bundle.getString("msg.noconecction"));
      return null;
  }
       list = new ArrayList<Vehicles>();
  String sql = "select * from vehicles";
  if (parametros != null) {
      Iterator it = parametros.entrySet().iterator();
      StringBuilder sb = new StringBuilder("");
      int i = 0;
      while (it.hasNext()) {
          if (i != 0){
            sb.append(" and ");
         }
         i++;
        Map.Entry e = (Map.Entry) it.next();
        sb.append(e.getKey() +"= '"+  e.getValue()+"'");
      }
      if (!sb.toString().equals("")){
         sql = sql + " where " + sb.toString();
      }
   }
  PreparedStatement psquery = con.prepareStatement(sql,ResultSet.TYPE_SCROLL_INSENSITIVE,
                                      ResultSet.CONCUR_UPDATABLE);
   ResultSet rs = psquery.executeQuery();
   rs.next();
   int x = rs.getRow();
   if (x == 0) {
          excepcion=new Exception(bundle.getString("msg.nofoundrecords") + "vehicles" +"  "+ bundle.getString("msg.withcode"));
          esMensaje =true;
      rs.close();
      psquery.close();
      return null;
   }
   rs.beforeFirst();
   while (rs.next()) {
   
        Vehicles vehicles2 = new Vehicles(
         rs.getLong("IDVEHICULO"),rs.getString("PLACA"),rs.getString("MARCA"),rs.getString("MODELO"),rs.getInt("ANIO"),rs.getString("CHASIS"),rs.getString("CAPACIDAD"),rs.getDouble("VALOR"),rs.getString("MOTOR"),rs.getString("COLOR"),rs.getString("DESCRIPCION"),rs.getString("TIPO"),rs.getString("COMBUSTIBLE"),rs.getString("USO"),rs.getString("ID"),rs.getString("TIPOID"),rs.getString("HIPOTECADO"),rs.getString("SECUESTRADO"),rs.getString("TRASPASO"),rs.getString("ACTIVO"),rs.getString("IDMUNICIPIO"),rs.getString("PAGOINSCRIPCION"),rs.getDate("FECHAINSCRIPCION"),rs.getDate("FECHA"),rs.getString("USERNAME"),rs.getString("LIQUIDACION"),rs.getDate("FECHALIQUIDACION"),rs.getString("MESPAGO"),rs.getString("FIDEICOMISO"));
            
            
       list.add(vehicles2);
    }
    rs.close();
    psquery.close();
    return list;
} catch (Exception ex) {
      excepcion = ex;
}
  return null;
}


/**
*
* Double fFunc(String funcion, String campo)
*/



public static Double func(String funcion, String campo) {
  excepcion = null;
  try {
      esMensaje =false;

  con= dataGManager.getCon();
  if (con == null) {
      excepcion=new Exception(bundle.getString("msg.noconecction"));
      return 0.0;
  }
      String sql = "select "+funcion+"("+campo+") as contador from vehicles";
  PreparedStatement psquery = con.prepareStatement(sql,ResultSet.TYPE_SCROLL_INSENSITIVE,
                                      ResultSet.CONCUR_UPDATABLE);
   ResultSet rs = psquery.executeQuery();
   rs.next();
   int x = rs.getRow();
   if (x == 0) {
          excepcion=new Exception(bundle.getString("msg.nofoundrecords") + "vehicles" +"  "+ bundle.getString("msg.withcode"));
          esMensaje =true;
      rs.close();
      psquery.close();
      return 0.0;
   }
    Double tmp =0.0;
   rs.beforeFirst();
   while (rs.next()) {
    tmp =  rs.getDouble("contador");
    }
    rs.close();
    psquery.close();
 return tmp;
} catch (Exception ex) {
      excepcion = ex;
}
  return 0.0;
}


/**
*
* Double func(String funcion, String campo,String where)
*/



public static Double func(String funcion, String campo, String where) {
  excepcion = null;
  try {
      esMensaje =false;

  con= dataGManager.getCon();
  if (con == null) {
      excepcion=new Exception(bundle.getString("msg.noconecction"));
      return 0.0;
  }
      String sql = "select "+funcion+"("+campo+") as contador from vehicles where "+where +" ";
  PreparedStatement psquery = con.prepareStatement(sql,ResultSet.TYPE_SCROLL_INSENSITIVE,
                                      ResultSet.CONCUR_UPDATABLE);
   ResultSet rs = psquery.executeQuery();
   rs.next();
   int x = rs.getRow();
   if (x == 0) {
          excepcion=new Exception(bundle.getString("msg.nofoundrecords") + "vehicles" +"  "+ bundle.getString("msg.withcode"));
          esMensaje =true;
      rs.close();
      psquery.close();
      return 0.0;
   }
    Double tmp =0.0;
   rs.beforeFirst();
   while (rs.next()) {
    tmp =  rs.getDouble("contador");
    }
    rs.close();
    psquery.close();
 return tmp;
} catch (Exception ex) {
      excepcion = ex;
}
  return 0.0;
}


/**
*
* count()
*/



public static Integer count() {
  excepcion = null;
  try {
      esMensaje =false;

  con= dataGManager.getCon();
  if (con == null) {
      excepcion=new Exception(bundle.getString("msg.noconecction"));
      return 0;
  }
      String sql = "select count(*) as contador from vehicles";
  PreparedStatement psquery = con.prepareStatement(sql,ResultSet.TYPE_SCROLL_INSENSITIVE,
                                      ResultSet.CONCUR_UPDATABLE);
   ResultSet rs = psquery.executeQuery();
   rs.next();
   int x = rs.getRow();
   if (x == 0) {
          excepcion=new Exception(bundle.getString("msg.nofoundrecords") + "vehicles" +"  "+ bundle.getString("msg.withcode"));
          esMensaje =true;
      rs.close();
      psquery.close();
      return 0;
   }
   rs.beforeFirst();
   while (rs.next()) {
    x =  rs.getInt("contador");
    }
    rs.close();
    psquery.close();
 return x;
} catch (Exception ex) {
      excepcion = ex;
}
  return 0;
}


/**
*
* count(String sqlquery)
*/



public static Integer count(String sqlquery) {
  excepcion = null;
  try {
      esMensaje =false;

  con= dataGManager.getCon();
  if (con == null) {
      excepcion=new Exception(bundle.getString("msg.noconecction"));
      return 0;
  }
      String sql = "select count(*) as contador from vehicles where  " + sqlquery +"";
  PreparedStatement psquery = con.prepareStatement(sql,ResultSet.TYPE_SCROLL_INSENSITIVE,
                                      ResultSet.CONCUR_UPDATABLE);
   ResultSet rs = psquery.executeQuery();
   rs.next();
   int x = rs.getRow();
   if (x == 0) {
          excepcion=new Exception(bundle.getString("msg.nofoundrecords") + "vehicles" +"  "+ bundle.getString("msg.withcode"));
          esMensaje =true;
      rs.close();
      psquery.close();
      return 0;
   }
   rs.beforeFirst();
   while (rs.next()) {
    x =  rs.getInt("contador");
    }
    rs.close();
    psquery.close();
 return x;
} catch (Exception ex) {
      excepcion = ex;
}
  return 0;
}


/**
*
* query()
*/

public static List<Vehicles> query(String query,boolean withRelation) {
  excepcion = null;
  try {
      esMensaje =false;

  con= dataGManager.getCon();
  if (con == null) {
      excepcion=new Exception(bundle.getString("msg.noconecction"));
      return null;
  }
        list = new ArrayList<Vehicles>();
  String sql = "select * from vehicles where " + query +"";
  if (query == null || query.equals("")) {
  return null;
   }
  PreparedStatement psquery = con.prepareStatement(sql,ResultSet.TYPE_SCROLL_INSENSITIVE,
                                      ResultSet.CONCUR_UPDATABLE);
   ResultSet rs = psquery.executeQuery();
   rs.next();
   int x = rs.getRow();
   if (x == 0) {
          excepcion=new Exception(bundle.getString("msg.nofoundrecords") + "vehicles" +"  "+ bundle.getString("msg.withcode"));
          esMensaje =true;
      rs.close();
      psquery.close();
      return null;
   }
   rs.beforeFirst();
   while (rs.next()) {
   
        Vehicles vehicles2 = new Vehicles(
         rs.getLong("IDVEHICULO"),rs.getString("PLACA"),rs.getString("MARCA"),rs.getString("MODELO"),rs.getInt("ANIO"),rs.getString("CHASIS"),rs.getString("CAPACIDAD"),rs.getDouble("VALOR"),rs.getString("MOTOR"),rs.getString("COLOR"),rs.getString("DESCRIPCION"),rs.getString("TIPO"),rs.getString("COMBUSTIBLE"),rs.getString("USO"),rs.getString("ID"),rs.getString("TIPOID"),rs.getString("HIPOTECADO"),rs.getString("SECUESTRADO"),rs.getString("TRASPASO"),rs.getString("ACTIVO"),rs.getString("IDMUNICIPIO"),rs.getString("PAGOINSCRIPCION"),rs.getDate("FECHAINSCRIPCION"),rs.getDate("FECHA"),rs.getString("USERNAME"),rs.getString("LIQUIDACION"),rs.getDate("FECHALIQUIDACION"),rs.getString("MESPAGO"),rs.getString("FIDEICOMISO"));
            
            
       list.add(vehicles2);
    }
    rs.close();
    psquery.close();
    return list;
} catch (Exception ex) {
      excepcion = ex;
}
  return null;
}


/**
*
* getListRecords()
*/

public static List<Vehicles> getListRecords(Map parametros,boolean withRelation) {
  excepcion = null;
  try {
      esMensaje =false;

  con= dataGManager.getCon();
  if (con == null) {
      excepcion=new Exception(bundle.getString("msg.noconecction"));
      return null;
  }
      list = new ArrayList<Vehicles>();
  String sql = "select * from vehicles";
  if (parametros != null) {
      Iterator it = parametros.entrySet().iterator();
      StringBuilder sb = new StringBuilder("");
      while (it.hasNext()) {
        Map.Entry e = (Map.Entry) it.next();
        sb.append(e.getKey() +"="+  e.getValue());
      }
      if (!sb.toString().equals("")){
         sql = sql + " where " + sb.toString();
      }
   }
  PreparedStatement psquery = con.prepareStatement(sql,ResultSet.TYPE_SCROLL_INSENSITIVE,
                                      ResultSet.CONCUR_UPDATABLE);
   ResultSet rs = psquery.executeQuery();
   rs.next();
   int x = rs.getRow();
   if (x == 0) {
          excepcion=new Exception(bundle.getString("msg.nofoundrecords") + "vehicles" +"  "+ bundle.getString("msg.withcode"));
          esMensaje =true;
      rs.close();
      psquery.close();
      return null;
   }
   rs.beforeFirst();
   while (rs.next()) {
       
        Vehicles vehicles2 = new Vehicles(
         rs.getLong("IDVEHICULO"),rs.getString("PLACA"),rs.getString("MARCA"),rs.getString("MODELO"),rs.getInt("ANIO"),rs.getString("CHASIS"),rs.getString("CAPACIDAD"),rs.getDouble("VALOR"),rs.getString("MOTOR"),rs.getString("COLOR"),rs.getString("DESCRIPCION"),rs.getString("TIPO"),rs.getString("COMBUSTIBLE"),rs.getString("USO"),rs.getString("ID"),rs.getString("TIPOID"),rs.getString("HIPOTECADO"),rs.getString("SECUESTRADO"),rs.getString("TRASPASO"),rs.getString("ACTIVO"),rs.getString("IDMUNICIPIO"),rs.getString("PAGOINSCRIPCION"),rs.getDate("FECHAINSCRIPCION"),rs.getDate("FECHA"),rs.getString("USERNAME"),rs.getString("LIQUIDACION"),rs.getDate("FECHALIQUIDACION"),rs.getString("MESPAGO"),rs.getString("FIDEICOMISO"));
            
            
       list.add(vehicles2);
    }
    rs.close();
    psquery.close();
    return list;
} catch (Exception ex) {
      excepcion = ex;
}
  return null;
 }


}
